package com.zmn.plat.admin.controller.channel.servicemaster;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
import com.zmn.plat.admin.controller.channel.ChannelBaseController;
import com.zmn.plat.model.entity.channel.Channel;

/**
 * 渠道服务工程师
 *
 * @author xiangjunming
 * @since 2019/10/16 19:10:20
 */
@Controller
@RequestMapping("/channel/servicemaster/")
public class ChannelServiceMasterListController extends ChannelBaseController {

    /**
     * 查询渠道服务工程师
     *
     * @param channelId
     *            the channel id
     * @return the model and view
     * @author xiangjunming
     * @since 2019/10/16
     */
    @RequestMapping(value = "list")
    @RequiresPermissions("/channel/servicemaster/list.action")
    @ReadOnlyConnection
    public ModelAndView list(Integer channelId, String addFlag) {
        ModelAndView mav = new ModelAndView("channel/servicemaster/list");
        Channel obj = channelService.findByKey(channelId);
        Integer mergeSettle = getMergeSettle(channelId);
        obj.setMergeSettle(mergeSettle);
        mav.addObject("obj", obj);
        mav.addObject("channelEngineerUri", getChannelEngineerUri(channelId, addFlag));
        mav.addObject("flag", 9);
        mav.addObject("addFlag", addFlag);
        return mav;
    }
}
